import { createRouter, createWebHistory, createWebHashHistory } from 'vue-router'

const router = createRouter({
  // history: createWebHistory(import.meta.env.BASE_URL),
  history: createWebHashHistory(import.meta.env.BASE_URL),

  routes: [
    {
      path: '/',
      name: 'home',
      component: ()=>import('../views/Home/home.vue'),
      meta: { keepAlive: false } //true缓存 false不缓存
    },
    {
      path: '/searchCourse',
      name: 'searchCourse',
      component: ()=>import('../views/Home/searchCourse.vue'),
      meta: { keepAlive: false }
    },
    {
      path: '/searchResult',
      name: 'searchResult',
      component: ()=>import('../views/Home/searchResult.vue'),
      meta: { keepAlive: false }
    },
    {
      path: '/login',
      name: 'login',
      component: ()=>import('../views/Login/login.vue'),
      meta: { keepAlive: false }
    },
    {
      path: '/improveResume',
      name: 'improveResume',
      component: ()=>import('../views/Login/improveResume.vue'),
      meta: { keepAlive: false }
    },
    {
      path: '/major',
      name: 'major',
      component: ()=>import('../views/Major/index.vue'),
      meta: { keepAlive: false }
    },
    {
      path: '/details',
      name: 'courseDetail',
      component: ()=>import('../views/Major/details.vue'),
      meta: { keepAlive: false }
    },
    {
      path: '/pay',
      name: 'pay',
      component: ()=>import('../views/Major/pay.vue'),
      meta: { keepAlive: false }
    },
    {
      path: '/news',
      name: 'news',
      component: ()=>import('../views/CampusNews/index.vue'),
      meta: { keepAlive: false }
    },
    {
      path: '/newsDetails',
      name: 'newsDetails',
      component: ()=>import('../views/CampusNews/newsDetails.vue'),
      meta: { keepAlive: false }
    },
    {
      path: '/knowledgeBase',
      name: 'knowledgeBase',
      component: ()=>import('../views/KnowledgeBase/index.vue'),
      meta: { keepAlive: false }
    },
    {
      path: '/knowledgeDetails',
      name: 'knowledgeDetails',
      component: ()=>import('../views/KnowledgeBase/knowledgeDetails.vue'),
      meta: { keepAlive: false }
    },
    {
      path: '/knowledgeSearch',
      name: 'knowledgeSearch',
      component: ()=>import('../views/KnowledgeBase/knowledgeSearch.vue'),
      meta: { keepAlive: false }
    },
    {
      path: '/graduate',
      name: 'graduate',
      component: ()=>import('../views/Employment/graduate.vue'),
      meta: { keepAlive: false }
    },
    {
      path: '/searchDetails',
      name: 'searchDetails',
      component: ()=>import('../views/Employment/searchDetails.vue'),
      meta: { keepAlive: false }
    },
    {
      path: '/my',
      name: 'my',
      component: ()=>import('../views/My/index.vue'),
      meta: { keepAlive: true }
    },
    {
      path: '/platformDetails',
      name: 'platformDetails',
      component: ()=>import('../views/My/platformDetails.vue'),
      meta: { keepAlive: false }
    },
    {
      path: '/my/withdrawals',
      name: 'withdrawal',
      component: ()=>import('../views/My/MyWallet/withdrawal.vue'),
      meta: { keepAlive: false }
    },
    {
      path: '/my/account',
      name: 'account',
      component: ()=>import('../views/My/MyWallet/account.vue'),
      meta: { keepAlive: false }
    },
    {
      path: '/myCourse',
      name: 'myCourse',
      component: ()=>import('../views/My/myCourse.vue'),
      meta: { keepAlive: false }
    },
    {
      path: '/myDevice',
      name: 'myDevice',
      component: ()=>import('../views/My/myDevice.vue'),
      meta: { keepAlive: false }
    },
    {
      path: '/setUp/changePhone',
      name: 'changePhone',
      component: ()=>import('../views/My/setUp/changePhone.vue'),
      meta: { keepAlive: false }
    },
    {
      path: '/setUp/changePsd',
      name: 'changePsd',
      component: ()=>import('../views/My/setUp/changePsd.vue'),
      meta: { keepAlive: false }
    },
    {
      path: '/setUp/helpCenter',
      name: 'helpCenter',
      component: ()=>import('../views/My/setUp/helpCenter.vue'),
      meta: { keepAlive: false }
    },
    {
      path: '/setUp/helpDetails',
      name: 'helpDetails',
      component: ()=>import('../views/My/setUp/helpDetails.vue'),
      meta: { keepAlive: false }
    },
    {
      path: '/setUp/aboutUs',
      name: 'aboutUs',
      component: ()=>import('../views/My/setUp/aboutUs.vue'),
      meta: { keepAlive: false }
    },
    {
      path: '/setUp/feedBook',
      name: 'feedBook',
      component: ()=>import('../views/My/setUp/feedBook.vue'),
      meta: { keepAlive: false }
    },
    {
      path: '/MyPoints/pointsDetails',
      name: 'pointsDetails',
      component: ()=>import('../views/My/MyPoints/pointsDetails.vue'),
      meta: { keepAlive: false }
    },
    {
      path: '/MyAssess/assessDetails',
      name: 'assessDetails',
      component: ()=>import('../views/My/MyAssess/assessDetails.vue'),
      meta: { keepAlive: false }
    },
    {
      path: '/MyOrder/orderDetails',
      name: 'orderDetails',
      component: ()=>import('../views/My/MyOrder/orderDetails.vue'),
      meta: { keepAlive: false }
    },
    {
      path: '/MyOrder/invoice',
      name: 'invoice',
      component: ()=>import('../views/My/MyOrder/invoice.vue'),
      meta: { keepAlive: false }
    },
    {
      path: '/courseMaterial',
      name: 'courseMaterial',
      component: ()=>import('../views/Major/courseMaterial.vue'),
      meta: { keepAlive: false }
    },
    {
      path: '/courseAssignments',
      name: 'courseAssignments',
      component: ()=>import('../views/Major/courseAssignments.vue'),
      meta: { keepAlive: false }
    },
    {
      path: '/competence',
      name: 'competence',
      component: ()=>import('../views/Major/competence.vue'),
      meta: { keepAlive: false }
    },
    {
      path: '/examResults',
      name: 'examResults',
      component: ()=>import('../views/Major/examResults.vue'),
      meta: { keepAlive: false }
    }
  ],
  scrollBehavior (to, from, savedPosition) {
    // 始终滚动到顶部
    return { top: 0 }
  }
})

export default router
